package com.sm.honkon.data.dao

import androidx.lifecycle.LiveData
import androidx.room.*
import com.sm.honkon.data.bean.CustomerEntity
import com.sm.honkon.data.bean.HandlerEntity
import kotlinx.coroutines.flow.Flow

/**
 * @description
 * @author csw
 * @date 2021-05-05
 */
@Dao
interface HandleDao {
    @Insert
    suspend fun insert(user: HandlerEntity)

    @Update
    suspend fun update(user: HandlerEntity)

    @Delete
    suspend fun delete(user: List<HandlerEntity>)

    @Query("Delete FROM handler")
    suspend fun deleteAll()

    @Query("SELECT * FROM handler")
    fun getHandlers(): LiveData<List<HandlerEntity>>

    @Query("SELECT * FROM handler")
    suspend fun getHandlersList(): List<HandlerEntity>

    @Query("SELECT * FROM handler WHERE uid = :id ")
    fun getHandlerById(id:Long): HandlerEntity
}